$(document).ready(function () {
    let meetingPage = 1;
    // getMetingList(1);
    // getExhibition(1);
    // $(document).on('click', '.meeting_dynamic_content_refresh', function () {
    //     meetingPage = meetingPage + 1
    //     getMetingList(meetingPage);
    // });
});

function getMetingList(page) {
    const loadIndex = layer.load(2);
    let datas = {
        url: '/api/user.user_conference/list',
        http_type: 'POST',
        datas: {
            "page": page,
            "page_size": 4
        }
    }
    wxx.HttpReqeust(datas, function (response) {
        layer.close(loadIndex)
        if (response.code == 1) {
            $(".meeting_dynamic_content").children(".meeting_dynamic_content_item").remove();
            for (let i = 0; i < response.data.data.length; i++) {
                let meeting_dynamic_content_item = $("<div class='meeting_dynamic_content_item'></div>")
                let div_1 = $("<div></div>")
                $(div_1).css("background-image", 'url(' + response.data.data[i].avatar + ')');
                let div_1_span = $("<span></span>")
                $(div_1_span).text('邀您' + response.data.data[i].createtime.substring(0, 9) + '参加')
                $(div_1).append(div_1_span)
                let p = $("<p></p>")
                $(p).text(response.data.data[i].title)
                let span_1 = $("<span></span>")
                $(span_1).text('主办方：' + response.data.data[i].sponsor ? response.data.data[i].sponsor : '暂无')
                let div_2 = $("<div></div>")
                let div_2_img = $("<img src='../../icons/icon_location.png'/>")
                let div_2_span_1 = $("<span></span>")
                $(div_2_span_1).text(response.data.data[i].region_text ? response.data.data[i].region_text : '暂无')
                let div_2_span_2 = $("<span></span>")
                $(div_2_span_2).text(response.data.data[i].type ? response.data.data[i].type : '暂无')
                $(div_2).append(div_2_img)
                $(div_2).append(div_2_span_1)
                $(div_2).append(div_2_span_2)
                $(meeting_dynamic_content_item).append(div_1)
                $(meeting_dynamic_content_item).append(p)
                $(meeting_dynamic_content_item).append(span_1)
                $(meeting_dynamic_content_item).append(div_2)
                $(".meeting_dynamic_content_refresh").before(meeting_dynamic_content_item)
            }
            return response.data.total
        } else {
            layer.alert(response.msg, {title: '温馨提示'});
        }
    });
}
function getExhibition(page) {
    const loadIndex = layer.load(2);
    let datas = {
        url: '/api/user.user_exhibition/list',
        http_type: 'POST',
        datas: {
            "page": page,
            "page_size": 4
        }
    }
    wxx.HttpReqeust(datas, function (response) {
        layer.close(loadIndex)
        if (response.code == 1) {
            $(".dynamic_content").children(".exhibition_dynamic_content_item").remove();
            for (let i = 0; i < response.data.data.length; i++) {
                let exhibition_dynamic_content_item = $("<div class='exhibition_dynamic_content_item'></div>")
                let span_1 = $("<span></span>")
                $(span_1).text(response.data.data[i].title)
                let div_1 = $("<div></div>")
                let div_2 = $("<div></div>")
                let div_2_img = $("<img src='../../icons/icon_location.png'/>")
                let div_2_span_1 = $("<span></span>")
                $(div_2_span_1).text(response.data.data[i].region_text ? response.data.data[i].region_text : '暂无')
                let div_2_span_2 = $("<span></span>")
                $(div_2_span_2).text(response.data.data[i].type ? response.data.data[i].type : '暂无')
                $(div_2).append(div_2_img)
                $(div_2).append(div_2_span_1)
                $(div_2).append(div_2_span_2)
                let span_2 = $("<span></span>")
                $(span_2).text(response.data.data[i].createtime.substring(0, 9))
                $(div_1).append(div_2)
                $(div_1).append(span_2)
                $(exhibition_dynamic_content_item).append(span_1)
                $(exhibition_dynamic_content_item).append(div_1)
                $('.exhibition_dynamic_content_refresh').before(exhibition_dynamic_content_item)
            }
            console.log('response',response)
        } else {
            layer.alert(response.msg, {title: '温馨提示'});
        }
    });
}
